<template>
  <div>
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="管理员ID">
        <el-input v-model="formInline.user" placeholder="请输入要搜索的ID"></el-input>
      </el-form-item>
      <el-form-item label="管理员角色">
        <el-select v-model="formInline.region" placeholder="请输入要搜索的角色名">
          <el-option
            v-for="item in selectList"
            :key="item.value"
            :label="item.label"
            :value="item.value">
            <span style="float: left">{{ item.label }}</span>
            <span style="float: right; color: #8492a6; font-size: 13px">{{ item.en }}</span>
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>

    <el-table :data="tableData" stripe style="width: 100%" :show-overflow-tooltip="true" align="center" height="700">
      <el-table-column prop="reginDate" label="创建时间" fixed="left" align="center"></el-table-column>
      <el-table-column prop="userId" label="账户ID" align="center"></el-table-column>
      <el-table-column prop="userName" label="账户昵称" align="center"></el-table-column>
      <el-table-column prop="options" label="操作" min-width="150" align="center"></el-table-column>
    </el-table>

    <div class="page">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                     :current-page="currentPage"
                     layout=" prev, pager, next" :total="30">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  export default {
    name: "AdminIndex",
    data() {
      return {
        selectList: [
          {label: '客服', en: 'KeFu', value: 'Kf'},
          {label: '管理', en: 'Admin', value: 'Ad'},
          {label: '超管', en: 'SuperAdmin', value: 'Sa'}
        ],
        tableData: [],
        formInline: {
          user: '',
          region: ''
        },
        currentPage: 1
      }
    },
    methods: {
      onSubmit() {
        alert(JSON.stringify(this.formInline))
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      }
    }
  }
</script>

<style scoped>
  .page {
    width: 100%;
    text-align: center;
    margin-top: 20px;
  }
</style>
